import httplib, time
from time import localtime, strftime
import teacher, student, parent
#connection = httplib.HTTPConnection("localhost:8080")
connection = httplib.HTTPConnection("www.mystudentlink.com")

# For scheduling info, see lib.pdf page 261-262
head = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}

print "Starting loop at " + strftime("%a, %d %b %Y %H:%M:%S", localtime())
tstarttime = time.time()
t_iter = teacher.testTeacher(connection, head)
print "Teacher set (" + str(t_iter) + " queries) took " + str(time.time() - tstarttime) + " seconds"

sstarttime = time.time()
s_iter = student.testStudent(connection, head)
print "Student set (" + str(s_iter) + " queries) took " + str(time.time() - sstarttime) + " seconds"

pstarttime = time.time()
p_iter = parent.testParent(connection, head)
print "Parent set (" + str(p_iter) + " queries) took " + str(time.time() - pstarttime) + " seconds"

print "One loop (" + str(t_iter + s_iter + p_iter) + " queries) took " + str(time.time() - tstarttime) + "seconds."
